(function(window){
	const Promise = function(executor){
		this.state = "pending";
		this.result = undefined;
		try{
			// 执行器函数是同步调用的
			executor(function(value){
				// 将状态更改为成功
				this.state = "fulfilled";
				// 接收的值为成功值
				this.result = value
			}.bind(this),function(value){
				// 将状态更改为失败
				this.state = "rejected";
				// 将失败值设置为value的值
				this.result = value;
			}.bind(this));
		}catch (err){
			// 将状态更改为失败
			this.state = "rejected";
			// 将失败值设置为err的值
			this.result = err;
		}
		
		console.log("over");
		
	}
	window.Promise = Promise;
})(window);
